package 第5章多线程编程作业.Work1.Work3;

public class Hostipal {
    public static void main(String[] args) {
        Vip v=new Vip();
        Thread t=new Thread(v,"特需号");
        t.start();
        Thread.currentThread().setName("普通号");
        for (int i = 1; i <51 ; i++) {
            if (i==10){
                try {
                    System.out.println("紧急插入特需号");
                    t.join();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println(Thread.currentThread().getName()+":"+i+"号正在看病");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
